import type { RouteRecordRaw } from 'vue-router'
import { util } from '@/utils'

export const getSSOAuthPath = () => {
  const authUrl = import.meta.env.VITE_TAFFE_AUTH_URL
  if (authUrl) {
    const clientId = import.meta.env.VITE_TAFFE_AUTH_CLIENT_ID
    const redirectUri = util.getSSORedirectUri()
    return `${authUrl}?response_type=code&client_id=${clientId}&scope=openid&redirect_uri=${redirectUri}`
  } else {
    return ''
  }
}

export const ssoRoutes: Array<RouteRecordRaw> = [
  {
    path: '/sso-verify',
    component: () => import(/* webpackChunkName: "sso" */ '@/views/sso/index.vue'),
    meta: { title: '验证' }
  }
]
